<template>
    <a-input-image-multi
        color="primary"
        v-model:value="imgs"
        :uploadFunc="uploadFunc"
        :getSrcFunc="getSrcFunc"
        :maxWidth="395"
    ></a-input-image-multi>
</template>

<script>
import utils from '../../../common/utils'

export default {
    data() {
        return {
            imgs: [],
            fakeImgs: [
                '32ad255a-8065-4763-a329-bb440859c2a9.jpg',
                '58c38d00-54b0-11eb-8b12-0b23616aea8a.jpg',
                '58d56750-54b0-11eb-8b12-0b23616aea8a.jpg',
                '58ac8290-54b0-11eb-8b12-0b23616aea8a.jpg',
            ],
            fakeImgIndex: 0
        }
    },
    methods: {
        async uploadFunc(file) {
            await utils.sleep(1000)
            this.fakeImgIndex = (this.fakeImgIndex + 1) % 4
            return this.fakeImgs[this.fakeImgIndex]
        },
        getSrcFunc(id) {
            return `http://snacksmart-dev.oss-accelerate.aliyuncs.com/${id}`
        }
    }
}
</script>